package andy.ham;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class LoginActivity extends Activity{
    private EditText passWord_Login;
    private Button button_login;
    private String passWD;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        passWord_Login = (EditText) findViewById(R.id.passWord);
        button_login = (Button) findViewById(R.id.loginButton);
        passWD="123";

        button_login.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                passWord_Login.getPaint().setFlags(0);
                passWD=passWord_Login.getText().toString();

                if(passWD.equals("helloworld")){
                    Intent intent = new Intent(LoginActivity.this,LifeDiary.class);
                    startActivity(intent);
                    finish();
                }else{
                    Toast.makeText(LoginActivity.this,"密码错误，请重新登录",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
